package Redis;

import redis.clients.jedis.Jedis;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class JedisMain {
    public static void main(String[] args) {
        Jedis jedis = new Jedis("localhost", 6379);
        jedis.set("hello", "world");
        String value = jedis.get("hello");
        System.out.println(value);
        jedis.incr("counter");
        jedis.hset("myhash", "f1", "v1");
        jedis.hset("myhash", "f2", "v2");
        Map<String, String> myhash = jedis.hgetAll("myhash");
        Set<Map.Entry<String, String>> entries = myhash.entrySet();

        for (Map.Entry<String, String> entry : entries) {
            System.out.println(entry.getKey());
            System.out.println(entry.getValue());
        }
        jedis.rpush("mylist", "1");
        jedis.rpush("mylist", "2");
        jedis.rpush("mylist", "3");
        List<String> mylist = jedis.lrange("mylist", 0, -1);
        for (String s : mylist) {
            System.out.println(s);
        }
        jedis.sadd("myset", "a");
        jedis.sadd("myset", "b");
        jedis.sadd("myset", "c");
        Set<String> myset = jedis.smembers("myset");
        for (String s : myset) {
            System.out.println(s);
        }
        String key = "club:1";
        Club club = new Club(1, "AC", "米兰", new Date(), 1);



    }
}
